﻿using System.Collections.Generic;
using System.Threading.Tasks;
using Furion;
using Furion.DynamicApiController;
using GWB.Application.Common;
using GWB.Application.SelectManage.Dtos;
using GWB.Application.SelectManage.SelectService;
using GWB.Core.Enum;
using Microsoft.AspNetCore.Mvc;

namespace GWB.Application.SelectManage
{

    /// <summary>
    /// 公共选择器
    /// </summary>
    [ApiDescriptionSettings("公共选择器", Tag = "选择器", SplitCamelCase = false)]
    public class SelectAppService : IDynamicApiController
    {

        /// <summary>
        /// 获取角色列表
        /// </summary>
        /// <returns></returns>
        [Authorization(Name = "获取角色列表", Code = AuthCode.None)]
        public async Task<List<SelectOutDto>> GetRoleList()
        {
            return await App.GetService<ISelectService>().GetRoleList();
        }

        /// <summary>
        /// 获取组织树
        /// </summary>
        /// <returns></returns>
        [Authorization(Name = "获取组织树", Code = AuthCode.None)]
        public async Task<List<ParentSelectOutDto>> GetOrgTre()
        {
            return await App.GetService<ISelectService>().GetOrgTre();
        }
    }
}
